using System;
using Tools.Common.UnitOfWork.Contracts;

namespace Web.App.Infrastructure.UnitOfWork.Implementations
{
    public class UoWStandardContainer : IUoWContainer
    {
        public IUnitOfWork Current
        {
            get
            {
                if (UnitOfWork.Current == null)
                    UoWService.InitializeUoW(null);
                return UnitOfWork.Current;
            }
        }

        public IUoWSession AsSession
        {
            get { throw new System.NotImplementedException(); }
        }

        public void ReplaceCurrentUnitOfWork(IUnitOfWork unitOfWork)
        {
            UnitOfWork.Current = unitOfWork;
        }
    }
}